<!DOCTYPE html>
<html lang="en">
<head>
    <title>我的订单</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="initial-scale=1.0, minimum-scale=1.0, maximum-scale=2.0, user-scalable=no, width=device-width">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" type="text/css" href="__STATIC__/yt_css/swiper.css">
    <link rel="stylesheet" type="text/css" href="__STATIC__/yt_css/style.css">
    <link rel="stylesheet" type="text/css" href="__STATIC__/yt_css/ipad.css">
    <link rel="stylesheet" type="text/css" href="__STATIC__/yt_css/iphone.css">
    <script type="text/javascript" src="__STATIC__/yt_js/jquery-1.9.0.min.js"></script>
    <script type="text/javascript" src="__PUBLIC__/js/layer/layer.js"></script>
    <script type="text/javascript" src="__ROOT__/public/static/js/layer/laydate/laydate.js"></script>
    <script type="text/javascript" src="__STATIC__/yt_js/jquery-1.9.0.min.js"></script>
    <script type="text/javascript" src="__PUBLIC__/js/global.js"></script>
</head>
<body class="body">
<div class="container">
    <include file="user/new_header" w="w1224"/>
    <div class="fexiao_content">
        <div class="left">
            <h2>分销中心</h2>
            <include file="user/new_menu"/>
        </div>
        <div class="right zuji_right">
            <h2>
                <a href="{:U('User/order_list')}" <if condition="$Request.param.type eq ''">class="active"</if>>所有订单</a>
                <a href="{:U('User/order_list',array('type'=>'WAITPAY'))}" <if condition="$Request.param.type eq 'WAITPAY'">class="active"</if>>待付款</a>
                <a href="{:U('User/order_list',array('type'=>'WAITSEND'))}" <if condition="$Request.param.type eq 'WAITSEND'">class="active"</if>>待发货</a>
                <a href="{:U('User/order_list',array('type'=>'WAITRECEIVE'))}" <if condition="$Request.param.type eq 'WAITRECEIVE'">class="active"</if>>待收货</a>
                <!--<a href="{:U('User/comment',array('status'=>'0'))}">待评价</a>-->
            </h2>

            <volist name="lists" id="list">
            <!-- 购物车单条数据循环 -->
            <div class="shoplist ddlist">
                <div class="shophead">
                    <label>
                        {$list.add_time|date='Y-m-d H:i:s',###}&emsp;订单号：{$list.order_sn}
                    </label>

                    <if condition="$list.cancel_btn eq 1">
                        <if condition="$list[pay_status] eq 0">
                            <a  href="javascript:void(0);" onClick="cancel_order({$list.order_id})" style="float: right">取消订单</a>
                            <else/>
                            <a style="float: right" href="javascript:void(0);" data-url="{:U('Home/Order/refund_order',array('order_id'=>$list[order_id]))}" onClick="refund_order(this)" >取消订单</a>
                        </if>
                    </if>
                    <span>{$list['order_status_desc']}</span>
                </div>
                <volist name="list.goods_list" id="goods" key="k">
                <div class="shopbody">
                    <a href=""><img src="{$goods.goods_id|goods_thum_images=90,90}" alt="{$goods.goods_name}"></a>
                    <div class="guige">
                        <h4>{$goods.goods_name}</h4>
                        <!--<span>黑色</span><span>均码</span>-->
                    </div>
                    <b>￥{$goods.member_goods_price}</b>
                    <if condition="$list.pay_btn eq 1">
                       <a class="zf" href="{:U('Home/Cart/cart4',array('order_id'=>$list[order_id]))}"  target="_blank">立即支付</a>
                       <!--<button onclick="go_pay(order_id)">立即付款</button>-->
                    </if>
                    <if condition="$list.receive_btn eq 1">
                        <a class="zf" href="javascript:;" onclick="order_confirm({$list.order_id});">确认收货</a>
                    </if>


                    <div class="clear"></div>
                </div>
                </volist>
            </div>
            <!-- 循环结束 -->
            </volist>

            <div class="tcdPageCode"></div>
        </div>
        <div class="clear"></div>
    </div>
    <include file="public/new_footer" w="w1224"/>
</div>

<script type="text/javascript">
    /*点击左边标签部分选中状态*/
    $(".left ul li a").click(function(){
        $(".left ul li a").removeClass("active");
        $(this).addClass("active");
    });
    $(".zuji_right h2 a").click(function(){
        $(".zuji_right h2 a").removeClass("active");
        $(this).addClass("active");
    })
    /*点击删除所在行*/
    $(".del").click(function(){
        $(this).parent().remove()
    })
</script>
<script>
    // 数量减
    $(".minus").click(function() {
        var t = $(this).parent().find('.am-num-text');
        t.val(parseInt(t.val()) - 1);
        if (t.val() <= 1) {
            t.val(1);
        }
    });
    // 数量加
    $(".plus").click(function() {
        var t = $(this).parent().find('.am-num-text');
        t.val(parseInt(t.val()) + 1);
        if (t.val() <= 1) {
            t.val(1);
        }
    });

    function order_confirm(order_id){
        layer.confirm("你确定收到货了吗?",{
            btn:['确定','取消']
        },function(){
            location.href='/index.php?m=Home&c=User&a=order_confirm&id='+order_id;
        })
    }
    //取消订单
    function cancel_order(id){
        layer.confirm('确定取消订单?', {
                    btn: ['确定','取消'] //按钮
                }, function(){
                    // 确定
                    location.href = "/index.php?m=Home&c=User&a=cancel_order&id="+id;
                }, function(index){
                    layer.close(index);
                }
        );
    }

    function refund_order(obj) {
        layer.open({
            type: 2,
            title: '<b>订单取消申请</b>',
            skin: 'layui-layer-rim',
            shadeClose: true,
            shade: 0.5,
            area: ['600px', '500px'],
            content: $(obj).attr('data-url'),
        });
    }
</script>
</body>

</html>